package com.chen.dome2recursion;

public class recursiondome2 {
    public static void main(String[] args) {
        //计算n的阶乘
        System.out.println(f(2));
    }
    public static int f(int n){//典型的递归算法
        if(n==1){
            return 1;
        }else{
            return n*f(n-1);
        }
    }
}
